package com.zhl.mybatis.user.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class User {
    @TableId(type = IdType.AUTO)
    private Long id;
    private String name;
    private Integer age;
    private String email;
    /**
     * 字段添加填充内容
     */
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime gmtCreate;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime gmtModified;
    @TableField(fill = FieldFill.INSERT)
    private String createBy;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private String updateBy;

    /**
     * 乐观锁(数据库要default = 0)
     */
    @Version
    private Integer version;

    /**
     * 逻辑删除 0未删除 1已删除
     *      TableField(select = false) 查询的时候不显示
     */
    @TableLogic
    @TableField(select = false)
    private Integer deleted;
}
